/**
 * 采用锁的方式
 *
 * @author Pymjl
 * @version 1.0
 * @date 2022/8/10 20:27
 **/
public class LazySingletonObject {
    private static LazySingletonObject singleton;

    private LazySingletonObject() {

    }

    /**
     * 该种方式效率会有折损，没有双重检查效率高
     *
     * @return {@code LazySingletonObject}
     */
    public synchronized static LazySingletonObject getInstance() {
        if (singleton == null) {
            singleton = new LazySingletonObject();
        }
        return singleton;
    }
}
